package my.service;

import java.sql.SQLException;
import java.util.List;

import my.bean.Cart;

public interface ICartService {
	/**
	 * add an cart record into CART
	 * @param cart
	 * @return the count of operation successfully insert into CART
	 * @throws SQLException
	 */
	public int addCart(Cart cart) throws SQLException;

	/**
	 * delete an cart record from CART
	 * @param id
	 * @return the count of operation successfully delete 
	 * @throws SQLException
	 */
	public int deleteCart(int id) throws SQLException;

	/**
	 * modify an cart record 
	 * @param cart
	 * @return the count of operation successfully modify
	 * @throws SQLException
	 */
	public int modifyCart(Cart cart) throws SQLException;

	/**
	 * find a list of cart by given tea's name and user's id
	 * @param name
	 * @param id
	 * @return a list of cart record
	 */
	public List<Cart> findByTeaName(int id, String name);

	/**
	 * find a list of cart by given tea's id and user's id 
	 * @param uid
	 * @param tid
	 * @return a list of cart record
	 */
	public List<Cart> findByTeaId(int uid, int tid);

	/**
	 * find a list of cart record for given user's id
	 * @param id
	 * @return a list of cart record
	 */
	public List<Cart> findByUserid(int id);

	/**
	 * find a cart record for given cart's id
	 * @param id
	 * @return a cart record
	 */
	public Cart findByCartId(int id);
}
